package com.qf.service.dangan_service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.bean.dangan.Users;
import com.qf.bean.dangan.dept;
import com.qf.dao.dangan_dao.UserDao;
import com.qf.service.dangan_service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 9/12/2019
 * Echo
 * sassspringboot
 * Alibaba
 */
@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    private UserDao userDao;

    @Override
    public PageInfo<Users> findUsers(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        List<Users> users = userDao.findUsers();
        PageInfo<Users> usersPageInfo = new PageInfo<>(users);
        return usersPageInfo;
    }

    @Override
    public int addpost(Users users) {
        return userDao.addpost(users);
    }

    @Override
    public Users updatepost(int uid) {
        return userDao.updatepost(uid);
    }

    @Override
    public int update(Users users) {
        return userDao.update(users);
    }

    @Override
    public int delete(int uid) {
        return userDao.delete(uid);
    }

    @Override
    public List<dept> findDept() {
        return userDao.findDept();
    }

    @Override
    public List<Users> findRoles(int did) {
        return userDao.findRoles(did);
    }


}
